﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 异或加密
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void jiami_Click(object sender, EventArgs e)
        {
            int srcNum = 0;
            int srcKey = 0;
            if( int.TryParse(lbSrc.Text, out srcNum) && 
                int.TryParse(lbKey.Text,out srcKey))
            {
                int result = srcKey ^ srcNum;
                lbDst.Text = result.ToString();
            }
            else
            {
                Console.WriteLine($"请输入数字......");
            }
        }

        private void jiemi_Click(object sender, EventArgs e)
        {
            // 
            int srcNum = 0;
            int srcKey = 0;
            if (int.TryParse(lbDst.Text, out srcNum) &&
                int.TryParse(lbKey.Text, out srcKey))
            {
                int result = srcKey ^ srcNum;
                lbDst2.Text = result.ToString();
            }
            else
            {
                Console.WriteLine($"老哥,先加密啊.....");
            }
        }
    }
}
